import React, { Component } from 'react'
import PropTypes from 'prop-types'

export default class PropTest extends Component {

  static propTypes = {
    num: PropTypes.number.isRequired,
    increment: PropTypes.func.isRequired
  }

  render() {
    const {num, increment} = this.props
    return (
      <div style={{background: '#cccccc'}}>
        <h2>{num}</h2>
        <button onClick={() => increment(2)}>增加</button>
      </div>
    )
  }
}
